perf(local): avoid loading the entire advisory unless it will actually be used#2450
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2450 +/- ##
=======================================
Coverage 67.79% 67.80%
=======================================
Files 172 172
Lines 13301 13305 +4
=======================================
+ Hits 9018 9022 +4
Misses 3573 3573
Partials 710 710 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
720b348 to
4671f6e
Compare
4671f6e to
b6cb3e2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Right now we always parse advisories even if we don't end up loading them into the database, which is relatively expensive at scale so now we use
gjsonto extract the subset of data we need from the raw bytes to determine if the advisory is relevant before we do the advisory parsing.This is especially useful for databases with a high amount of MAL advisories since their packages are very rare, such as the NPM database (which has 209647 MAL advisories out of a total of 214057 advisories) - before this it takes about 10 seconds to do a scan, whereas after this optimization it takes about 3 seconds